package com.aischool.api;

import com.aischool.params.AiTeacherParams;
import com.aischool.routes.RouteMapping;
import com.aischool.service.AiTeacherService;
import com.aischool.utils.AppUtil;
import com.aischool.utils.JsonCodeEnum;
import com.aischool.utils.JsonResult;
import com.jfinal.aop.Inject;
import com.jfinal.core.Controller;

@RouteMapping(url = "/api/teacher")
public class AiTeacherController extends Controller {
	
	@Inject
	AiTeacherService aiTeacherService;

	public void getPage() {
		// 结果类
		JsonResult jr = new JsonResult();
		// 参数类
		AiTeacherParams params = new AiTeacherParams();
		// 获取参数
		params.setOrgId(getInt("org_id",0));
		params.setPageNo(getParaToInt("pageNo", getParaToInt("pageNumber", 1))); // 兼容e参数
		params.setPageSize(getParaToInt("pageSize", AppUtil.Default_PageSize));
		params.setKeywords(getPara("teacher_name", ""));
		// 获取分页
		Object pageData = aiTeacherService.getPage(params);
		
		jr.setDicKV("pageData", pageData);
		
		jr.setEnum(JsonCodeEnum.Success);
		renderJson(jr.Dic);
	}
}
